package com.yunsc.order.orderEnum;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.converters.WriteConverterContext;
import com.alibaba.excel.metadata.data.WriteCellData;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-05-28 21:34
 */
public class PayMethodConverter implements Converter<String> {

    @Override
    public WriteCellData<?> convertToExcelData(WriteConverterContext<String> context) throws Exception {
        // return Converter.super.convertToExcelData(context);
        // 自定义转换逻辑： 支付方式(balance:余额/ wechat: 微信/ alipay: 支付宝)
        // 余额: 余额支付
        // 微信: 微信支付
        // 支付宝: 支付宝支付
        String payMethod = context.getValue();
        if (payMethod.equals("balance")) {
            return new WriteCellData<>("余额支付");
        } else if (payMethod.equals("wechat")) {
            return new WriteCellData<>("微信支付");
        } else if (payMethod.equals("alipay")) {
            return new WriteCellData<>("支付宝支付");
        } else {
            return new WriteCellData<>("未知支付方式");
        }
    }
}
